#pragma once

#include <vector>

// Forward declarations
class D3DManager;
class DirectInput;
class TextureManager;
class SoundManager;
class ShaderManager;
class Timer;
class IGameState;
class GameCursor;
//

class Game
{
	// Singleton
	Game(void);
	Game(const Game&);
	virtual ~Game(void);
	Game& operator =(const Game&);
	//

	// Accessors to DirectX and XAudio
	D3DManager		*d3dManager;
	TextureManager	*textureManager;
	DirectInput		*input;
	SoundManager	*soundManager;
	ShaderManager	*shaderManager;
	Timer			*time;
	GameCursor		*cursor;
	//

	// The game loop
	void Render();
	void Update();
	void Input();
	//

	// Tells us whether the game is running or not
	bool running;

	// The current state that the game is in
	std::vector<IGameState*>	states;

public:
	static Game* getInstance();

	void Initialize();
	void Shutdown();

	// Start running the game
	void Run();

	// Pass NULL to end the program
	void AddState(IGameState *pState);
	void RemoveState(bool bEndGame = false);

	bool getRunning() const { return running; }
	void setRunning(bool val) { running = val; }
};

